home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Champak 142
/
Volume 142 Oct 17 2011 - Damaged.iso
/
Games
/
operation-graduates.swf
/
scripts
/
frame_41
/
DoAction_7.as
< prev
next >
Wrap
Text File
|
2011-10-17
|
3KB
|
105 lines
function spawnSwooper(xSpot)
{
var _loc1_ = enemyContainer.attachMovie("swooper","enemy" + eConCount++,eConCount);
_loc1_.gotoAndStop(1);
_loc1_._x = xSpot;
_loc1_._y = (- _loc1_._height) / 2;
_loc1_.approaching = true;
_loc1_.retreating = false;
_loc1_.energy = 20;
_loc1_.t = 0;
_loc1_.d = 40;
_loc1_.sR = _loc1_._rotation;
_loc1_.cR = 0;
_loc1_.sY = _loc1_._y;
_loc1_.cY = 300;
_loc1_.move = swooperMover;
_loc1_.Q1logic = baddyQ1;
_loc1_.Q2logic = baddyQ2;
_loc1_.Q3logic = baddyQ3;
_loc1_.Q4logic = baddyQ4;
_loc1_.hit = swooperHit;
this.isHit = false;
_loc1_.shoot = swooperShoot;
_loc1_.collide = baddyCollide;
}
function swooperMover()
{
if(this.isHit)
{
this.resetColor();
this.isHit = false;
}
with(this)
{
if(approaching)
{
if(t < d)
{
t++;
_y = Math.easeOutQuad(t,sY,cY,d);
_rotation = Math.atan2(_y - theHull._y,_x - theHull._x) * 57.29577951308232 + 90;
if(t == d)
{
shoot(_x,_y);
this.t = 0;
this.d = 40;
this.sR = this._rotation;
this.cR = - this._rotation;
this.sY = this._y;
this.cY = -40 - this._y;
this.approaching = false;
this.retreating = true;
}
}
}
else if(retreating)
{
if(t < d)
{
t++;
_y = Math.easeInQuad(t,sY,cY,d);
_rotation = Math.easeInQuad(t,sR,cR,d);
if(t == d)
{
this.removeMovieClip();
}
}
}
}
}
function swooperHit()
{
var _loc1_ = this;
_loc1_.setRGB(16777215);
_loc1_.isHit = true;
_loc1_.energy -= 5;
if(_loc1_.energy <= 0)
{
playSound("sound.missile.explode");
explode(_loc1_);
addScore(300);
baddyKillCount++;
}
}
function swooperShoot(startX, startY)
{
var _loc1_ = this;
var _loc2_ = eBullets.attachMovie("eBul2","bullet" + eBulletsCount++,eBulletsCount);
playSound("sound.gun2");
_loc2_._x = startX;
_loc2_._y = startY;
_loc2_.vel = new Vector(theHull._x - startX,theHull._y - startY);
_loc2_.vel.setLength(5);
_loc2_.onEnterFrame = function()
{
var _loc1_ = this;
_loc1_._x += _loc1_.vel.x;
_loc1_._y += _loc1_.vel.y;
if(_loc1_._x < 0 || _loc1_._x > 600 || _loc1_._y < 0 || _loc1_._y > 400)
{
_loc1_.removeMovieClip();
}
};
}